<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    *{
        padding: 0;
        margin: 0;
        list-style: none;
    }
    ul{
        width: auto;
        height: auto;
    }
    li{
        width: 50px;
        height: auto;
        float: left;
    }
    .lii{
        width: auto;
    }
</style>
<body>
    <ul>
        <li class="lii"><img src="./img/ifold1.jpg" alt=""></li>
        <li><img src="./img/ifold2.jpg" alt=""></li>
        <li><img src="./img/ifold3.jpg" alt=""></li>
        <li><img src="./img/ifold4.jpg" alt=""></li>
        <li><img src="./img/ifold5.jpg" alt=""></li>
        <li><img src="./img/ifold6.jpg" alt=""></li>
        <li><img src="./img/ifold7.jpg" alt=""></li>
    </ul>
    <script>
        var lis=document.querySelectorAll('li')
        for(var i=0;i<lis.length;i++){
            lis[i].onclick=function(){
                var res=document.querySelector('.lii')
                if(res){
                    res.classList.remove('lii')
                }
                this.classList.add('li')
            }
        }
    </script>
</body>
</html>